unit uMeetingTimeRoomForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uAbstractForm, XPMan,uMeetingControl, StdCtrls, Buttons, ExtCtrls,
  Grids, DBGrids, DB;

type
  TMeetingTimeRoomForm = class(TAbstractForm)
    datFreeTimeList: TDataSource;
    datFreeRoomList: TDataSource;
    dbgFreeTimeList: TDBGrid;
    dbgFreeRoomList: TDBGrid;
    pnlBottom: TPanel;
    btnOk: TBitBtn;
    btnCancel: TBitBtn;
    procedure FormShow(Sender: TObject);
    procedure datFreeTimeListDataChange(Sender: TObject; Field: TField);
  private
    { Private declarations }
  public
    { Public declarations }
    Meeting_ID:integer;
    StartDate:TDateTime;
    Duration:integer;
  end;

var
  MeetingTimeRoomForm: TMeetingTimeRoomForm;

implementation

{$R *.dfm}

procedure TMeetingTimeRoomForm.datFreeTimeListDataChange(Sender: TObject;
  Field: TField);
var FreeTime:TTime;
begin
  inherited;
  if datFreeTimeList.DataSet <> nil then
  begin
    FreeTime:=datFreeTimeList.DataSet.FieldByName('FREE_TIME').AsDateTime;
    datFreeRoomList.DataSet:=TMeetingControl.GetInstance.GetFreeRoomList(Meeting_ID,
                                                                          StartDate,
                                                                          FreeTime,
                                                                          Duration);
    datFreeRoomList.DataSet.First;
  end;

end;

procedure TMeetingTimeRoomForm.FormShow(Sender: TObject);
begin
  inherited;
  datFreeTimeList.DataSet:=
    TMeetingControl.GetInstance.GetTimeList(Meeting_ID,
                                                StartDate,
                                                Duration);
    datFreeTimeList.DataSet.First;
end;

end.
